<script language="javascript" type="text/javascript">
{literal}
editAreaLoader.init({
	id : "code_preview", syntax: "php", start_highlight: true, language : "de", allow_toggle : false
});
{/literal}
</script>

<h1>{if isset($name)}{$name}{else}Neuer DevMod erstellen{/if}</h1>

<form action="#" onsubmit="$('code_preview').update(editAreaLoader.getValue('code_preview')); BkLoader.Post(this).Load('devmod_add'); return false;"  method="post" name="devadd">
<div class="block" style="margin-top:20px;">
	<h1 onclick="Effect.toggle('dmprop', 'slide')" style="cursor:pointer;"><img src="{$theme}img/icons/gear.png" border="0" /> Einstellungen</h1>
	<div id="dmprop" {if isset($name)}style="display:none;"{/if}>
		<table class="padding_table" style="width:100%;">
			<tr>
				<td width="180">Name:</td>
				<td><input type="text" class="text" name="name" value="{if isset($name)}{$name}{/if}" /></td>			
			</tr>
			<tr>
				<td>Verwendetes:</td>
				<td><input type="text" class="text" name="theme" value="{if isset($theme_name)}{$theme_name}{else}$this->theme{/if}" /></td>
			</tr>
			<tr>
				<td>MySQL Tabelle Daten von:</td>
				<td><select name="devmod_table">
				{foreach from=$sql_tables item=item key=key}
					<option value="{$item->id}"	{if isset($sql_id) && $sql_id == $item->id} selected="selected" {/if}	>{$item->name}</option>
				{/foreach}
			</select></td>
			</tr>
			<tr>
				<td>Fixed Frontend <strong>List</strong> Template:</td>
				<td>
					<select name="tpl_frontend_list">
						<option value="">Kein Template zuweisen</option>
					{foreach from=$tpls item=item}
						{assign var=pp value=$item|pathinfo} 
						{if $pp.extension eq "tpl"}
						<option value="{$item}" {if isset($tpl_frontend_list) && $tpl_frontend_list eq $item}selected="selected"{/if}>{$item}</option>
						{/if}
					{/foreach}
					</select>
				</td>
			</tr>
			<tr>
				<td>Fixes Frontend <strong>Add</strong> Template:</td>
				<td>
					<select name="tpl_frontend_add">
						<option value="">Kein Template zuweisen</option>
					{foreach from=$tpls item=item}
						{assign var=pp value=$item|pathinfo} 
						{if $pp.extension eq "tpl"}
						<option value="{$item}" {if isset($tpl_frontend_add) && $tpl_frontend_add eq $item}selected="selected"{/if}>{$item}</option>
						{/if}
					{/foreach}
					</select>
				</td>
			</tr>
		</table>
	</div>
</div>

<div class="block">
	<h1 onclick="Effect.toggle('dmcode', 'slide')" style="cursor:pointer;"><img src="{$theme}img/icons/edit-code.gif" border="0" /> Code</h1>
	<div id="dmcode">
		<textarea id="code_preview" rows="35" cols="130" style="width:730px;" name="content" class="textarea">{if isset($code)}{$code}{/if}</textarea>
	</div>
</div>
{if isset($name)}
<div class="block">
	<h1 onclick="Effect.toggle('dmembed', 'slide')" style="cursor:pointer;"><img src="{$theme}img/icons/embed.gif" border="0" /> Embed Codes</h1>
	<div id="dmembed" style="display:none;">
		<table class="padding_table" style="width:100%;">
			<tr>
				<td width="130">Frontend_List Embed</td>
				<td><input type="text" class="text" value='[devmod id="{$id}" type="frontend_list"]' />
			</tr>
			<tr>
				<td>Frontend_Add Embed</td>
				<td><input type="text" class="text" value='[devmod id="{$id}" type="frontend_add"]' />
			</tr>
		</table>
	</div>
</div>
{/if}
<div style="clear:both; margin-top:10px; padding:5px;">
<input type="submit" class="submit" name="submit" value="Speichern" />
</div>

{if isset($id)}
<input type="hidden" name="edit_id" value="{$id}" />
{/if}
</form>